package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note.txt",true);
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入：");
        while(true){
            String data = scan.nextLine();
            if("exit".equals(data)){
                break;
            }
            fos.write(data.getBytes(StandardCharsets.UTF_8));
        }
        fos.close();
        System.out.println("输出完毕");
    }
}
